package com.server.kit;

import java.io.File;

public class FileKit {

    public static void delete(File file) {
        if ((file != null) && (file.exists())) {
            if (file.isFile()) {
                file.delete();
            } else if (file.isDirectory()) {
                File[] files = file.listFiles();
                for (int i = 0; i < files.length; i++) {
                    delete(files[i]);
                }
            }
            file.delete();
        }
    }

    public static File getFile(String path) {
        File file = new File(path);
        if (!file.exists()) {
            file = null;
        }
        return file;
    }
}
